<?php 
    include_once 'buslibs/products.php';
    
    
    if(key_exists('productId',$_GET) && isset($_GET['productId']))
        echo "Invalid product id";
    else
    {
        $product=read_product($productId);
        echo "<h1>{$product['title']} </h1> <br/>";
        echo "<p>{$product['price']}</p>";
        if (isset($product['description']))
            echo "<p>{$product['description']}</p>";
        echo "<p>{$product['quantity']}</p>";
        if(key_exists('role',$_SESSION))
            if($_SESSION['role']=='admin' || $_SESSION['userId']==$product['ownerId'])
                {?><form method="get">
                    <input type="hidden" value=<?php echo $product['id']; ?> 
                    <input type="submit" value="Διαγραφή">
                </form>
                <?php }   
    }
    
?>
